<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>VP战队重回世界之巅全程回顾</title>
		<link rel="stylesheet" type="text/css" href="../css/reset.css"/>
		<link rel="stylesheet" type="text/css" href="../css/iconfont.css"/>
		<link rel="stylesheet" type="text/css" href="../css/detail.css"/>
		<link rel="stylesheet" type="text/css" href="../css/zy.media.min.css"/>
		<script type="text/javascript" src="../js/jquery-2.0.3.js"></script>
		<script type="text/javascript" src="../layer/layer.js"></script>
		<script type="text/javascript" src="../js/rem.js"></script>
		<script type="text/javascript">
			$(window).load(function() {
				$('#box').delay(350).show()
			})
		</script>
	</head>
	<body>
			<!--页面加载 开始-->
		<!-- <div id="preloader">
		    <div id="status">
		      <p class="center-text"><span>拼命加载中···</span></p>
		    </div>
		  </div>-->
		  <!--页面加载 结束-->
		  <div id="box">
			<!--内容区-->	
			<section class="detail">
			    <div class="detail-cont">
					<!--<div class="zy_media">
					    <video class="video" height="100%" poster="../img/ban.jpg" data-config='{"mediaTitle": "斗鱼直播"}'>
					        <source src="http://220.167.105.121/170/2/11/acloud/151672/letv.v.yinyuetai.com/he.yinyuetai.com/uploads/videos/common/6609014F06AE1C8E99DE142502A2B157.flv?crypt=95aa7f2e98550&b=1314&nlh=3072&nlt=45&bf=6000&p2p=1&video_type=flv&termid=0&tss=no&geo=CN-23-323-1&platid=0&splatid=0&its=0&qos=5&fcheck=0&proxy=3062324601,2101603530,3683272595&uid=3063271287.rp&keyitem=GOw_33YJAAbXYE-cnQwpfLlv_b2zAkYctFVqe5bsXQpaGNn3T1-vhw..&ntm=1447949400&nkey=55c24f4c47dd315085c383e07750f67e&nkey2=3344c026a5c147651522c75bc51fb700&sc=0e90a16b75f7bc55&br=3136&vid=782863&aid=1559&area=KR&vst=0&ptp=mv&rd=yinyuetai.com?sc=0e90a16b75f7bc55&errc=0&gn=1065&buss=106551&cips=182.149.207.119&lersrc=MTI1Ljg5Ljc0LjE3MQ==&tag=yinyuetai&cuhost=letv.v.yinyuetai.com&cuid=151672&flw3x=0&sign=coopdown&fext=.flv&br=3136&ptp=mv&rd=yinyuetai.com" type="video/mp4">
					        您的浏览器不支持HTML5视频
					    </video>
					</div>--><!--
			         <i class="iconfont video-pause">&#xe61c;</i>
			         <i class="iconfont video-start">&#xe629;</i>-->
			         <i onclick="goBack()" class="iconfont">&#xe63a;</i>
				</div>
				<div class="detail-title clear">
					<!--<div class="detail-title-left">
						<p>VP战队重回世界之巅全程回顾</p>
						<p>by 斗鱼TV | DOTA2 /03'09"</p>
					</div>-->
					<!--<div class="detail-title-right">
						 <i class="iconfont video-save">&#xe607;</i>
						 <span>缓存</span>
					</div>-->
				</div>
				<div class="detail-content clear">
					<!--<ul>
						<li><img src="../img/images/circle_07.jpg"/></li>
						<li>斗鱼TV</li>
						<li>全民直播平台</li>
						<li>已关注</li>
						<li><i class="iconfont detail-share">&#xe62d;</i></li>
					</ul>-->
				</div>
				<div class="detail-content-p">
					<!--<p>
						虽说《英雄联盟》中，很多女英雄都是天生的尤物，那身材，那脸蛋都是女神般的存在，但是你们可曾知道，有的出身卑微、有的双亲离世、有的甚至一生都经历坎坷，那么今天我们来整理一下在《英雄联盟》中那些最让人怜惜的十位女英雄。
				   </p>-->
				</div>
				
				<div class="detail-content-foot">
					<div class="detail-collection">
						<i class="iconfont my-collection"></i>
					</div>
					<div class="detail-foot-middle">
						<!--<ul class="clear">
							<li>
								<i class="iconfont">&#xe604;</i>
							     <span>103</span>
							</li>
							<li></li>
							<li>
								<i class="iconfont">&#xe626;</i>
							     <span>103</span>
							</li>
							<li></li>
							<li>
								<i class="iconfont">&#xe62b;</i>
							     <span>103</span>
							</li>
						</ul>-->
					</div>
				</div>
		   </section>
		  </div>
	</body>
	<script type="text/javascript" src="../js/reset.js"></script>
	<script type="text/javascript" src="../js/zy.media.min.js"></script>
	<script type="text/javascript" src="../js/iscroll.js"></script>
	<script type="text/javascript">
	var c=localStorage.getItem("video_id")
	var b=localStorage.getItem("user_id")
	console.log(c)
	console.log(b)
	    /*视频加载*/
	    playVideo()
	    function playVideo(){
	    	$.ajax({
            type: 'POST',
            url: 'http://192.168.199.114:8080/HJF/user/get_video_info.do',
            dataType: 'JSON',
            data:{user_id:b,video_id:c},
            success: function(data){
            	console.log(data)
            	/*视频*/
            	var oDiv=$('<div class="zy_media">'+
					    '<video class="video" controls="controllers" width="100%" height: 100%; poster="'+data.data.video_img_url+'">'+
					       ' <source src="'+data.data.video_url +'" type="video/mp4">您的浏览器不支持HTML5视频'+
					    '</video></div>')
             $('.detail-cont').append(oDiv)
             /*视频标题*/
              var oDIV2=$('<div class="detail-title-left">'+
						'<p>'+data.data.video_title+'</p>'+
						'<p>by '+data.data.channel_name+' | '+data.data.video_label_name+' / '+data.data.video_time+'</p>'+
					'</div><div class="detail-title-right">'+
						 '<i class="iconfont video-save">&#xe607;</i>'+
						 '<span>缓存</span>'+
					'</div>')
              /*描述*/
              var oP=$('<p>'+data.data.video_summary+'</p>')
              /*关注的频道频道内容*/
             if(data.data.channel_is_followed==0){
             	var oUl=$('<ul>'+
						'<li><img src="'+data.data.channel_head_img_url+'"/></li>'+
						'<li>'+data.data.channel_name+'</li>'+
						'<li>'+data.data.channel_summary+'</li>'+
						'<li class="myfocus">未关注</li>'+
						'<li><i class="iconfont detail-share">&#xe62d;</i></li>'+
					'</ul>')
             }else{
             	var oUl=$('<ul>'+
						'<li><img src="'+data.data.channel_head_img_url+'"/></li>'+
						'<li>'+data.data.channel_name+'</li>'+
						'<li>'+data.data.channel_summary+'</li>'+
						'<li class="myfocus">已关注</li>'+
						'<li><i class="iconfont detail-share">&#xe62d;</i></li>'+
					'</ul>')
             }
            
              var aLi=$('<ul class="clear"><li><i class="iconfont">&#xe604;</i>'+
							     '<span class="video_collect_num">'+data.data.video_collect_num+'</span>'+
							 '</li><li></li>'+
							'<li><i class="iconfont">&#xe626;</i>'+
							     '<span>'+data.data.video_share_num+'</span>'+
							'</li><li></li>'+
							'<li><i class="iconfont">&#xe62b;</i>'+
							     '<span class="video_comment">'+data.data.video_comment_num+'</span>'+
							'</li></ul>')
              /*是不是已收藏*/
               if(data.data.video_is_collected==1){
               	console.log(data.data.video_is_collected)
	               	$('.my-collection').html('&#xe605;')
	               	$('.my-collection').on('click',function(){
	               	$('.my-collection').html('&#xe602;')
				      	$.ajax({
				            type: 'POST',
				            url: 'http://192.168.199.114:8080/HJF/user/cancel_collect_video.do',
				            dataType: 'JSON',
				            data:{user_id:b,video_id:c},
				            success: function(data){
				            	 console.log(data)
				            	$('.video_collect_num').html($('.video_collect_num').html()*1-1)
				                layer.msg('已取消');
				            },
				            error: function(xhr, type){
				                alert('Ajax error!');
				            }
				        });	
	               	})
                 }else{
	               	$('.my-collection').html('&#xe602;')
	               	/*点击收藏*/
	               	var num=0;
	               $('.my-collection').on('click',function(){
	               	if(num++ %2 == 0){
		               	$('.my-collection').html('&#xe605;')
				      	$.ajax({
				            type: 'POST',
				            url: 'http://192.168.199.114:8080/HJF/user/collect_video.do',
				            dataType: 'JSON',
				            data:{user_id:b,video_id:c},
				            success: function(data){
				            	layer.msg('已收藏');
				            	$('.video_collect_num').html($('.video_collect_num').html()*1+1)
				              console.log(data)
				            },
				            error: function(xhr, type){
				                alert('Ajax error!');
				            }
				        });
	               	}else{
	                  $('.my-collection').html('&#xe602;')
				      	$.ajax({
				            type: 'POST',
				            url: 'http://192.168.199.114:8080/HJF/user/cancel_collect_video.do',
				            dataType: 'JSON',
				            data:{user_id:b,video_id:c},
				            success: function(data){
				            	$('.video_collect_num').html($('.video_collect_num').html()*1-1)
				               layer.msg('已取消');
				            },
				            error: function(xhr, type){
				                alert('Ajax error!');
				            }
				        });
	               	}
			      })
               }
              
               /*添加到页面中*/
         $('.detail-content-p').append(oP)
         $('.detail-title').append(oDIV2)
         $('.detail-content').append(oUl)
         $('.detail-foot-middle').append(aLi)
         /*关注和取消关注频道*/
        var channel=data.data.channel_id
         if(data.data.channel_is_followed==0){
         	$('.myfocus').on('click',function(){
         		$.ajax({
				            type: 'POST',
				            url: 'http://192.168.199.114:8080/HJF/user/follow_channel.do',
				            dataType: 'JSON',
				            data:{user_id:b,channel_id:channel},
				            success: function(data){
				            	console.log(data)
				            	$('.myfocus').html('已关注')
				            	/*取消频道*/
				            	$('.myfocus').one('click',function(){
				            		$.ajax({
						            type: 'POST',
						            url: 'http://192.168.199.114:8080/HJF/user/cancel_follow_channel.do',
						            dataType: 'JSON',
						            data:{user_id:b,channel_id:channel},
						            success: function(data){
						            	$('.myfocus').html('未关注')
						            	
						            },
						            error: function(xhr, type){
						                alert('Ajax error!');
						            }
						        });
				            	})
				            },
				            error: function(xhr, type){
				                alert('Ajax error!');
				            }
				        });
         	})
         }else{
         	$('.myfocus').on('click',function(){
         		$.ajax({
				            type: 'POST',
				            url: 'http://192.168.199.114:8080/HJF/user/cancel_follow_channel.do',
				            dataType: 'JSON',
				            data:{user_id:b,channel_id:channel},
				            success: function(data){
				            	$('.myfocus').html('未关注')
				            	/*关注频道*/
				            	$('.myfocus').one('click',function(){
				            		$.ajax({
						            type: 'POST',
						            url: 'http://192.168.199.114:8080/HJF/user/follow_channel.do',
						            dataType: 'JSON',
						            data:{user_id:b,channel_id:channel},
						            success: function(data){
						            	$('.myfocus').html('已关注')
						            	
						            },
						            error: function(xhr, type){
						                alert('Ajax error!');
						            }
						        });
				            	})
				            },
				            error: function(xhr, type){
				                alert('Ajax error!');
				            }
				        });
         	})
         }
         
         /*视频缓存*/
             $('.video-save').on('click',function(){
             	layer.msg('已缓存');
             	localStorage.setItem('huancun',data.data.video_id)
             })
         /*跳转页面*/    
        $('.detail-share').on('click',function(){
        	localStorage.setItem('channel_id',data.data.channel_id)
	    	window.location.href="alreadyfocus.html"
	    })
        
         $('.video_comment').on('click',function(){
         	localStorage.setItem('video_summary',data.data.video_summary)
         	localStorage.setItem('video_img_url',data.data.video_img_url)
         	localStorage.setItem('channel_name',data.data.channel_name)
	    	window.location.href="comments.html"
	    })
            /*视频播放*/
             zymedia('video');
            },
            error: function(xhr, type){
                alert('Ajax error!');
               
            }
       });
	   }
	   /*视频收藏*/
	   
       	
       	
	</script>
</html>
